
#include <iostream>
#include <QtWidgets/QMainWindow>
#include "WidgetsManager.h"



WidgetsManager* WidgetsManager::_instance = NULL;

WidgetsManager::WidgetsManager( QObject *parent /*= 0*/ )
{
    //this->setWindowState(Qt::WindowMaximized);
}

WidgetsManager::~WidgetsManager()
{

}

WidgetsManager* WidgetsManager::instance()
{
    if (_instance == NULL)
    {
        _instance = new WidgetsManager();
    }
    return _instance;

}

void WidgetsManager::addWidgetToMap(const QString &str, QWidget *widgetPtr)
{
    m_widgetsMap[str] = widgetPtr;
}

QWidget *WidgetsManager::getWidgetFromMap(const QString &str)
{
    if(m_widgetsMap.contains(str))
    {
        return m_widgetsMap[str];
    }
    return NULL;
}

void WidgetsManager::closeEvent(QCloseEvent *event)
{
    //std::cout<<"WidgetsManager::closeEvent"<<std::endl;
    //SimProcess::instance()->getSimPro()->kill();
	//SimManager::instance()->stopOsg();
	emit signalWidgetsManagerClosed();

    // QMainWindow::closeEvent(event);
}

